package cc.yugu.yhdw.webserver.service.basic;

import cc.yugu.yhdw.common.domain.basic.WeixinPayOrder;
import cc.yugu.yhdw.common.entity.pagination.Page;
import cc.yugu.yhdw.webserver.persistence.basic.WeixinPayOrderMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 微信支付订单业务
 * 
 * @Date:Created in 2018/7/5 16:01
 * @Author:
 * @Modified By: zjn 2018/7/5 16:01
 */ 
@Service
public class WeixinPayOrderService {
    @Autowired
    WeixinPayOrderMapper weixinPayOrderMapper;
    /**
    * 通过左外连接 根据表bas_weixin_pay_order 中的支付人、来源类型、来源id、订单状态等字段来
     * 查询表bas_weixin_pay_order和bas_customer中指定字段数据
    * 
    * @Param: [search]
    * @Return: cc.yugu.yhdw.common.domain.basic.WeixinPayOrder
    * @Author By: zjn 2018/7/5  16:02
    */ 
    public WeixinPayOrder find(WeixinPayOrder search) {
        return weixinPayOrderMapper.find(search.getCustomerId(), search.getSourceType(), search.getSourceId(), search.getOrderStatus());
    }
    /**
    * 分页查询
    * 
    * @Param: [search]
    * @Return: cc.yugu.yhdw.common.entity.pagination.Page
    * @Author By: zjn 2018/7/5  16:02
    */ 
    public Page findPage(WeixinPayOrder search) {
        Page page = search.buildPage();
        page.setTotalItems(weixinPayOrderMapper.findPageCount(search));
        search.setBeginIndex(page.getOffset());
        page.setResult(weixinPayOrderMapper.findPageResult(search));
        return page;
    }
}
